<?php defined('IN_YuLin') || exit('NO PERMIT!'); ?>
{template index/header}
<div class="subnav" style="margin-bottom:20px;">
    <a href="">首页</a> &gt; <a href="">客户管理</a> &gt; <a href="">会员列表</a>
</div>

<div class="x-body">
	<div id="searchid" class="layui-clear">
		<form name="searchform" class="layui-form" action="?" method="get" >
			<input type="hidden" name="m" value="{$m}" />
			<input type="hidden" name="c" value="{$c}" />
			<input type="hidden" name="a" value="{$a}" />
			<div class="left" style="width:130px;margin-bottom:20px">
				<select name="upuid">
					<option value="0">选择代理</option>
					{loop $agents as $key => $val}
                    <option value="{$val['id']}"{if $upuid == $val['id']} selected="selected"{/if}>{$val['username']}({$val['sons']})</option>
                    {/loop}
				</select>
			</div>
			<div class="left margin-l10" style="width:100px;">
				<select name="status">
					<option value="0">选择状态</option>
					{loop $statuss as $key => $val}
						{_ !$key && $key = -1}
                    <option value="{$key}"{if $status == $key} selected="selected"{/if} >{$val}</option>
                    {/loop}
				</select>
			</div>
			<div class="left margin-l10">
				<input name="dt1" id="dt1" type="text" value="{$dt1}" class="layui-input date datetimepicker8" style="width:100px;" placeholder="注册时间" />
			</div>
			<div class="left margin-l10" style="padding-top:10px;">~</div>
			<div class="left margin-l10">
				<input name="dt2" id="dt2" type="text" value="{$dt2}" class="layui-input date datetimepicker8" style="width:100px;" placeholder="注册时间" />
			</div>
			<div class="left margin-l10">
				<input name="title" id="title" type="text" value="{$title}" class="layui-input" style="width:260px;" placeholder="请输入关键词" />
			</div>
			<div class="left margin-l10" style="width:130px;">
				<select name="orderby">
					{loop $orderbys as $key => $val}
                    <option value="{$key}"{if $orderby == $key} selected="selected"{/if}>{$val}</option>
                    {/loop}
				</select>
			</div>
			<div class="left margin-l10">
				<input type="submit" name="search" class="layui-btn" value="搜索" />
			</div>
			<div class="left margin-l10">
				<input type="submit" name="export" class="layui-btn" value="导出" />
			</div>
		</form>
	</div>
	
	<table class="layui-table">
		<thead>
			<tr>
				<th>上级</th>
				<th>账号</th>
				<th>昵称</th>
				<th>会员类型</th>
				<th>余额</th>
				<th>返点</th>
				<th>注册日期</th>
				<th>注册IP</th>
				<th>最后登录IP</th>
				<th>下级人数</th>
				<th>状态</th>
				<th>推广码</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody id="datalist">
			{loop $data as $val}
			<tr>
				<td><a href="?m={$m}&c={$c}&upuid={$val['upuid']}">{$upuids[$val['upuid']]['username']}</a></td>
				<td>{$val['username']}</td>
				<td>{$val['nickname']}</td>
				<td>{$gids[$val['gid']]}</td>
				<td>{$val['money']}</td>
				<td>{$val['rebate']}%</td>
				<td>{date('Y/m/d H:i:s',$val['reg_time'])}</td>
				<td>{$val['reg_ip']}</td>
				<td>{$val['last_ip']}</td>
				<td><a href="?m={$m}&c={$c}&upuid={$val['id']}">{$val['sons']}</a></td>
				<td>
					<select onchange="SetUserStatus({$val['id']},this)">
						{loop $statuss as $sk => $sv}
						<option value="{$sk}"{if $sk == $val['status']} selected="selected"{/if}>{$sv}</option>
						{/loop}
					</select>
				</td>
				<td>{$val['id']}</td>
				<td>
					<a href="?m={$m}&c={$c}&a=add&id={$val['id']}">编辑</a>
					<!--<a href="?m={$m}&c=bank&uid={$val['id']}">配额设置</a>-->
					<a href="?m={$m}&c=bank&uid={$val['id']}">银行卡</a>
					<a href="?m={$m}&c={$c}&a=view&uid={$val['id']}" class="a-dialog" data-width="1000px" data-height="500px;">用户详情</a>
					<!--<a href="?m={$m}&c=bank&uid={$val['id']}">彩票设定</a>-->
					<!--<a href="?m={$m}&c=bank&uid={$val['id']}">新增下级</a>-->
					<!--<a href="?m={$m}&c=bank&uid={$val['id']}">游戏管理</a>-->
					<a href="javascript:;" class="recharge" data-id="{$val['id']}">充值</a>
					<a href="?m={$m}&c=order&uid={$val['id']}" class="red a-dialog" data-full="1">下注</a>
					<a href="?m={$m}&c={$c}&a=infolog&uid={$val['id']}" class="a-dialog" data-full="1">记录</a>
					<!--<a href="?m={$m}&c=bank&uid={$val['id']}">代理QQ设置</a>-->
				</td>
			</tr>
			{/loop}
		</tbody>
	</table>
	<div class="layui-clear">
		<div id="pages" class="layui-laypage right">{$multi}</div>		
	</div>
	<div id="recharge">
		<div class="r-box">
			<form action="?m=user&c=index&a=recharge" class="r-form" method="post">
				<ul>
					<li class="r-input r-money"><span>金额：</span><input type="text" name="money" value=""></li>
					<li class="r-input r-remark"><span>备注：</span><input type="text" name="remark" value=""></li>
					<li class="r-btn">
						<span></span>
						<input type="hidden" value="0" name="id" class="r-uid">
						<input type="button" value="充值" class="saveBtn">
						<input type="button" value="关闭" class="closeBtn">
					</li>
				</ul>
			</form>
		</div>
	</div>
</div>
<style>
	#recharge{ width: 100%; position: fixed; background: rgba(0,0,0,.3); color: #000; top: 0; left: 0; display: none; }
	.r-box{ width: 400px; height: 300px; background: #fff; margin-left: 35%; margin-top: 200px; }
	.r-box ul li{ height: 80px; line-height: 80px;}
	.r-box ul li span{ display: inline-block; width: 80px; text-align: right; font-size: 20px; }
	.r-box ul li.r-input:nth-child(1){ margin-top: 40px; }
	.r-box ul li.r-input input{ height: 50px; width: 300px; text-align: center; font-size: 30px; border: 1px solid rgba(0, 150, 136); border-radius: 5px; outline: none; }
	.r-box ul li.r-btn input{ background: rgba(0, 150, 136); border: none; height: 40px; padding: 0 25px; margin-right: 20px; font-size: 20px; color: #fff; border-radius: 5px; cursor: pointer; outline: none; }
</style>
<script>
	$(function(){
		$("#recharge").height($(document).height())
		$(".closeBtn").on('click',function(){
			$("#recharge").hide();
		})
		$(".recharge").on('click',function(){
			$(".r-uid").val($(this).attr('data-id'));
			$("#recharge").show();
		})
		$(".saveBtn").on('click',function(){
			var uid = $(".r-uid").val(), money = $(".r-money input").val(), remark = $(".r-remark input").val();
			if(!parseInt(uid,10)){
				alert('充值失败！');return;
			}
			if(isNaN(money) || parseFloat(money,10) <= 0){
				alert("请输入正确的金额！");return;
			}
			$(".r-form").submit();
		})
	});
	function SetUserStatus(id,obj)
	{
		//var index = layer.msg('状态修改中',{icon: 16,time:false,shade:0.8});
		var flag = $(obj).val();
		$.get('{U($m."/".$c."/del")}&id=' + id + '&flag=' + flag,function(res){
			//layer.close(index);
			layer.msg('状态修改成功！');
		});
	}

</script>
<script type="text/javascript" src="static/js/datetime.js"></script>
{template index/footer}